<template>
  <div class="hello">
    <h1>我最棒</h1>
    <p v-for="(item, index) of list" :key="index">{{item.name}}</p>
  </div>
</template>

<script>
import testApi from "@/api/test";

export default {
  name: "HelloWorld",
  created() {
    this.initData();
  },
  data(){
    return{
      list: []
    }
  },
  methods: {
    initData() {
      testApi.getList().then(res =>{
        console.log('组件请求返回数据---> ', res.data)
        this.list = res.data
      })
    }
  }
};
</script>

<style scoped lang="scss">
</style>
